﻿<%@ Page Language="VB" MasterPageFile="~/MasterPage.master" AutoEventWireup="false" CodeFile="Messages.aspx.vb" Inherits="_Default" title="CrIcKet-My Messages" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
    <style type="text/css">


        .style1
        {
            font-size: large;
            color: #0066FF;
        }
        .style2
        {
            font-size: medium;
        }
        .style3
        {
            font-size: small;
            text-align: right;
        }
        </style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder2" Runat="Server">
    <center>
    <p>
        <span class="style1">
        <asp:Label ID="Label1" runat="server" Text="Welcome "></asp:Label>
        <asp:Label ID="Label2" runat="server" Text="Username"></asp:Label>
        &nbsp;</span></p>
        <p class="style1">
            Inbox Messages :</p>
        <p>
            <asp:SqlDataSource ID="SqlDataSource2" runat="server" 
            ConnectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\Database.mdf;Integrated Security=True;User Instance=True" 
            ProviderName="System.Data.SqlClient" 
            
                SelectCommand="SELECT [msgid],[message], [date], [sender] FROM [message] WHERE ([receiver] = @receiver)" 
                DeleteCommand="DELETE FROM message WHERE (msgid = @msgid)">
            <SelectParameters>
                <asp:SessionParameter DefaultValue="0" Name="receiver" SessionField="username" 
                    Type="String" />
                 
            </SelectParameters>
                <DeleteParameters>
                    <asp:Parameter Name="msgid" />
                </DeleteParameters>
        </asp:SqlDataSource>
        
        
        
                <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" 
            DataSourceID="SqlDataSource2" AllowSorting=True Width="386px" CellPadding="4" 
                ForeColor="#333333" GridLines="None" 
                EmptyDataText="No Messages To Display">
                       
                    <RowStyle BackColor="#F7F6F3" ForeColor="#333333" />
                       
                    <Columns  >
                        <asp:BoundField DataField="msgid" HeaderText="MessageId" InsertVisible="False" 
                            ReadOnly="True" SortExpression="msgid" />
                        <asp:BoundField DataField="message" HeaderText="Message" 
                            SortExpression="message" />
                        <asp:BoundField DataField="date" HeaderText="Date" SortExpression="date" />
                        <asp:BoundField DataField="sender" HeaderText="Sender" 
                            SortExpression="sender" />
                        <asp:ButtonField ButtonType="Image" ImageUrl="~/images/deleteicon.gif" 
                            Text="Button" CausesValidation="True" CommandName="select"  />
                    </Columns>
                    
                     
                    
                    <FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
                    <PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />
                    <SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" />
                    <HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
                    <EditRowStyle BackColor="#999999" />
                    <AlternatingRowStyle BackColor="White" ForeColor="#284775" />
                    
                     
                    
        </asp:GridView>
        
        
        </p>
        
                                        <span class="style2">Send Message</span><table>
        <tr>
        <td>
        
            <span class="style3">Select User ID :</span></td>
        <td align="right" style="text-align: left">
        
            <span class="style3"> <span class="style2">
        <asp:DropDownList ID="DropDownList1" runat="server" DataSourceID="SqlDataSource1" 
                DataTextField="username" DataValueField="username" Height="20px" 
                TabIndex="1">
        </asp:DropDownList>
            <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
                ConnectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\Database.mdf;Integrated Security=True;User Instance=True" 
                ProviderName="System.Data.SqlClient" 
                SelectCommand="SELECT [username] FROM [users]"></asp:SqlDataSource>
        </span>
        </span>
        
        </td>
        </tr>
        
        <tr>
        <td align="right" valign="top">
        <span class="style2"><span class="style3">Message :</span></span></td>
        <td align="right" valign="top">
        
            <span class="style2">
        <asp:TextBox ID="TextBox1" runat="server" TextMode="MultiLine" TabIndex="2"></asp:TextBox>
            <br />
            <center>
            <asp:Label ID="Label3" runat="server" style="text-align: center"></asp:Label></center>
        </span>
        </td>
        </tr>
        
        <tr>
        <td colspan=2>
        
        <asp:Button ID="Button1" runat="server" Text="Send Message" TabIndex="3" />
        
        </td>
        </tr>
        
        </table>
        
        </span>
    </center>
    
                 
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
</asp:Content>

